/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Component;

import com.chlitina.store.common.persistence.BaseDao;
import com.chlitina.store.common.persistence.BaseDaoImpl;
import com.chlitina.store.modules.expert.entity.Product;

/**
 * 产品DAO接口
 * @author lvbo
 * @version 2013-06-04
 */
public interface ProductDao extends ProductDaoCustom, CrudRepository<Product, Long> {

	@Modifying
	@Query("update Product set status=?1 where id = ?2")
	public int changeStatus(int status, Long id);
	
	@Modifying
	@Query("from Product where status=?1")
	public List<Product> findAllAvailable(int status);

}

/**
 * DAO自定义接口
 * @author lvbo
 */
interface ProductDaoCustom extends BaseDao<Product> {

}

/**
 * DAO自定义接口实现
 * @author lvbo
 */
@Component
class ProductDaoImpl extends BaseDaoImpl<Product> implements ProductDaoCustom {

}
